﻿using Sasa.QualityTools.CodeAnalysis.Common;
using System;
using System.Collections.Generic;
using System.Runtime.Versioning;
using MSBuild = Microsoft.Build.Utilities;
using System.Diagnostics.CodeAnalysis;

namespace Sasa.QualityTools.CodeAnalysis.FxCopIntegrator.VisualStudio
{
    public class SilverlightProject : Project
    {
        [SuppressMessage("Microsoft.Design", "CA1031")]
        public override IEnumerable<string> DependencyDirectories
        {
            get
            {
                try
                {
                    var moniker = project.Properties.Item("TargetFrameworkMoniker").Value.ToString();
                    var name = new FrameworkName(moniker);
                    return MSBuild.ToolLocationHelper.GetPathToReferenceAssemblies(name);
                }
                catch (Exception ex)
                {
                    Logger.Error(ex, "Failed to get path to reference assemblies path of '{0}' project.", project.Name);
                    return null;
                }
            }
        }


        public SilverlightProject(EnvDTE.Project project)
            : base(project)
        {
        }
    }
}
